package com.plian.system.wrapper.hr.staff;

import com.plian.system.dto.hr.staff.DirectorDTO;
import com.plian.system.entity.hr.staff.Director;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.hr.staff.DirectorVO;
import com.plian.system.vo.zzd.sys.PersonnelSimpleInfoVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 近五年三个月以上培训情况包装类,返回视图层所需的字段
 *
 * @author gangan
 * @since 2019-11-12
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface DirectorWrapper extends BaseWrapper<Director, DirectorDTO, DirectorVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "companyId", target = "companyName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "companyId", target = "companyCode", qualifiedByName = ORG_ID_TO_CODE),
			@Mapping(source = "genderId", target = "genderName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "directorshipId", target = "directorshipName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "politicCountenanceId", target = "politicCountenanceName" , qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "educationalId", target = "educationalName" , qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "documentNumber", target = "documentNumber", qualifiedByName = DECRYPT_BASE64_DATA)
	})
	DirectorVO entityToVO(Director entity);

	@Mappings(value = {
			@Mapping(source = "directorshipId", target = "jobName", qualifiedByName = DICT_CODE_TO_NAME)
	})
	PersonnelSimpleInfoVO entityToPersonnelSimpleInfoVO(Director entity);

	List<PersonnelSimpleInfoVO> entityToPersonnelSimpleInfoVO(List<Director> entityList);
}
